package com.myclasses;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

import com.google.gdata.data.calendar.CalendarEventEntry;

public class EventTable {
  private List<EventBean> eventItems = new ArrayList<EventBean>();
  {

  }

  public List<EventBean> getEventItems() {
	  CalendarControler calendarControler = CalendarControler.getInstance();
	  eventItems.clear();
	  
	  try{
		  Collection<CalendarEventEntry> entries = calendarControler.downloadAllEvents();
		  for (CalendarEventEntry entry : entries) {
			  eventItems.add(new EventBean(entry));
		  }
	  }catch (Exception e) {
		  System.out.println(e.getMessage());
	  }
    return this.eventItems;
  }
  
  public int getSize() {
    return this.eventItems.size();
  }
}